  var request = require('request');
  var urlApi = 'http://61.129.33.248:8084/MetroDataApi/api/allprojects/';
  request({
      method: 'Get',
      url: urlApi
  }, function(error, response, body) {
      var fs = require('fs');
      var json2csv = require('json2csv');
      var colors = require('colors');
      var prjs = JSON.parse(JSON.parse(body));
      console.log('\n工程信息已全部下载完成.'.grey);
      json2csv({
          data: prjs,
          fields: ['PrjId', 'Name']
      }, function(err, csv) {
          if (err) console.log(err);
          fs.writeFile('./projects.csv', csv, function(err) {
              if (err) throw err;
              console.log('\n文件已保存在projects.csv中!\n'.green)
              console.error('Excel会乱码,请使用记事本打开.'.green);
          });
      });
  });
